/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.jhelper.unit06.demo;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author Administrator
 */
public class ListOper {
    public static void main(String[] args) {
        List l = new ArrayList();
        
        for(int i=0; i<10; i++){
            l.add(new Integer(i));
        }
        
        System.out.println("列表元素内容如下：");
        System.out.println(l);
        
        System.out.println("遍历整个集合元素:");
        Iterator i = l.iterator();
        while(i.hasNext()){
            Integer tmp = (Integer) i.next();
            System.out.print(tmp.intValue()+" ");
        }
        System.out.println();
        System.out.println("从第6个元素开始读取数据");
        i = l.listIterator(5);
        while(i.hasNext()){
            Integer tmp = (Integer) i.next();
            System.out.print(tmp.intValue()+" ");
        }
        System.out.println();
    }
}
